<template>
	<view class="page">
		<view class="page_con">
			<view class="page_top">
				<view class="phone">
					{{userInfo.mobile}}
				</view>
				<view class="num_item">
					<image src="@/static/img/my/log.png" mode=""></image>
					<view class="text">
						<view class="">
							已收集
						</view>
						<text>{{num}}</text>
						<view class="">
							枚章
						</view>
					</view>
				</view>
			</view>
			<view class="con_section">
				<view class="section_2 ">
					<view class="image-text_5 " @click="openWeb('/pages/my/order')">
						<image class="icon_4" referrerpolicy="no-referrer" src="@/static/img/my/icon1.png" />
						<text class="text-group_1">已兑订单</text>
					</view>
					<view class="image-text_5 " @click="openWeb('/pages/home/activityDesc?type=2')">
						<image class="icon_4" referrerpolicy="no-referrer" src="@/static/img/my/icon2.png" />
						<text class="text-group_1">活动说明</text>
					</view>
					<view class="image-text_5 " @click="call">
						<image class="icon_4" referrerpolicy="no-referrer" src="@/static/img/my/icon3.png" />
						<text class="text-group_1">联系客服</text>
					</view>
					<view class="image-text_5 " @click="login_Out()">
						<image class="icon_4" referrerpolicy="no-referrer" src="@/static/img/my/icon4.png" />
						<text class="text-group_1">退出登录</text>
					</view>
					<view class="group_1 flex-col"></view>
				</view>
			</view>
		</view>
		<!-- 底部tabBar -->
		<tabbar current="2"></tabbar>
	</view>
</template>

<script>
	import {
		toLogin
	} from '@/utils/toLogin.js';
	import {
		getBadgeAllCount,
		loginOut
	} from '@/api/api.js'
	import tabbar from '@/components/tabBar.vue' //自定义tabBar
	export default {
		data() {
			return {
				num: 0,
				userInfo: {}
			};
		},
		components: {
			tabbar,
		},
		onLoad() {
			this.getCount()
			this.userInfo = uni.getStorageSync("userInfo")
		},
		methods: {
			login_Out() {
				uni.showModal({
					title: '提示',
					content: '确认要退出登录吗？',
					confirmColor: "#000",
					success: function(res) {
						if (res.confirm) {
							// console.log('用户点击确定');
							loginOut().then(res => {
								if (res.code == 0) {
									uni.showToast({
										icon: 'none',
										title: '退出登录成功'
									})
									setTimeout(() => {
										toLogin()
									}, 500)
								}
							})
						} else if (res.cancel) {
							// console.log('用户点击取消');
						}
					}
				})
			},
			getCount() {
				getBadgeAllCount().then(res => {
					this.num = res.data
				})
			},
			call() {
				uni.makePhoneCall({
					phoneNumber: '021-31006868'
				});
			},
			openWeb(v) {
				uni.navigateTo({
					url: v
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.page {
		padding-bottom: 116rpx;
	}

	.page_con {
		min-height: calc(100vh - 116rpx);
		min-height: calc(100dvh - 116rpx);
		background-image: url('@/static/img/my/my_back.png');
		background-size: contain;
		background-repeat: no-repeat;
		background-position: top center;
		position: relative;
		padding: 0 20rpx;

		.page_top {
			padding: 150rpx 20rpx 0;

			.phone {
				font-size: 42rpx;
				color: #004EA5;
					font-weight: 600;
			}

			.num_item {
				display: flex;
				align-items: center;
				width: 350rpx;
				height: 55rpx;
				line-height: 55rpx;
				background: #FFFFFF;
				border-radius: 23rpx;
				margin-top: 20rpx;

				image {
					width: 58rpx;
					height: 58rpx;
				}

				.text {
					margin-left: 20rpx;
					font-size: 28rpx;
					color: #004EA5;
					display: flex;
					justify-content: flex-start;
					font-weight: 600;
					text{
						margin: 0 6rpx ;
						font-size: 48rpx;
					}
				}

			}
		}

		.section_2 {
			background-color: rgba(255, 255, 255, 1);
			border-radius: 24px;
			padding: 20rpx 40rpx;
			margin-top: 50rpx;


			.image-text_5 {
				display: flex;
				justify-content: flex-start;
				align-items: center;
				padding: 20rpx 0;
				border-bottom: 1px solid #EDEDED;

				&:nth-child(4) {
					border: none;
				}

				.icon_4 {
					width: 35rpx;
					height: 36rpx;
				}

				.text-group_1 {
					color: rgba(0, 0, 0, 1);
					font-size: 28rpx;
					margin-left: 17rpx;
				}
			}

		}
	}
</style>
